<HTML><HEAD><TITLE>rerecord(+Key, ?Value)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Recorded Database</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>rerecord(+Key, ?Value)</H1>
Erases all entries recorded under the key Key and replaces them with the
given value Value.


<DL>
<DT><EM>Key</EM></DT>
<DD>An atom or a compound term.
</DD>
<DT><EM>Value</EM></DT>
<DD>Any prolog term.
</DD>
</DL>
<H2>Description</H2>
   Used to erase all values associated with Key and then record the term
   Value under the key Key.  If Key does not exist previously, it will
   record Value under Key in the indexed database.  In the case of compound
   terms, all keys of the same name and arity are treated as equal.

<P>
   Backtracking through a call of rerecord/2 does not undo erasure of the
   erased values and the value Value is not removed.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>rerecord(+, ?) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Key is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Key is neither an atom nor a compound term.
</DL>
<H2>Examples</H2>
<PRE>
   Success:
   [eclipse]: record(beer,lowenbrau),
   &gt;        record(beer,paulaner),
   &gt;        record(beer,spaten),
   &gt;        rerecord(beer,guinness).
   yes.
   [eclipse]: recorded(beer,Value).
   Value = guinness     More? (;)
   no (more) solution.
   [eclipse]: erase_all(beer),rerecord(beer,guinness).
   yes.
   [eclipse]: recorded(beer,guinness).
   yes.
   Error:
   rerecord(Beer,anything).                (Error 4)
   rerecord(1,anything).                   (Error 5)
   rerecord(1.0,anything).                 (Error 5)
   rerecord("str",anything).               (Error 5)



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/record/erase_all-1.html">erase_all / 1</A>
</BODY></HTML>
